﻿package 
{
	import flash.display.Sprite;
	import flash.events.*;
	import flash.geom.*;
	import org.summerTree.graphics.CreativeGraphics;
	import org.summerTree.graphics.Base;
	import org.summerTree.components.Slider;
	
	import flash.geom.Point;

	public class Main extends Sprite
	{
		private var creative:CreativeGraphics;
		private var Taiji_sprite:Base;
		private var Star_sprite:Base;		 
		private var Crear_sprite:Base;		
		private var polygon_sprite:Base;
		private var curve_sprite:Base;
		private var rose_sprite:Base;
		private var circle_sprite:Base;
	    private var diamond_sprite:Base;
		private var sector_sprite:Base;
		private var helix_sprite:Base;
		private var sin_sprite:Base;
		private var arc_sprite:Base;
		private var tree_sprite:Base;
		private var fish_sprite:Base;
		private var arrow_sprite:Base;
		private var flower_sprite:Base;
		
		private  var slider:Slider;
		private  var slider2:Slider;
		private  var slider3:Slider;
		private  var slider4:Slider;
		private  var slider5:Slider;
		private  var slider6:Slider;
		private  var slider7:Slider;
		private  var slider8:Slider;
		private  var slider9:Slider;
		private  var slider10:Slider;
		private  var slider11:Slider;
		private  var slider12:Slider;
		private  var slider13:Slider;
		
		private  var slider14:Slider;
		private  var slider15:Slider;
		private  var slider16:Slider;
		
		public function Main()
		{
			init();
		}
		
		private function init():void
		{
			creative=new CreativeGraphics();
			addChild(creative);		
			(Taiji_sprite=creative.drawTaiJi(30)).move(80,50);
			
			(Star_sprite=creative.drawStar(30,20)).move(250,50);
			
			(Crear_sprite=creative.drawGearWheel(30,25)).move(400,50);
			
			(polygon_sprite=creative.drawPolygon(30,5)).move(80,200);
			
			(curve_sprite=creative.drawBeautifulCurve(70,5,10)).move(250,200);
			
			(rose_sprite=creative.drawRose(50,2)).move(400,200);
			
			(circle_sprite=creative.drawCirque(40,20)).move(80,350);
			
			(diamond_sprite=creative.drawDiamond(50)).move(250,350);
			
			(sector_sprite=creative.drawSector(60,0,40)).move(400,350);
			
			
			(helix_sprite=creative.drawHelixLine(2,3)).move(80,500);
			(sin_sprite=creative.drawSinLine(30,5,50,3,new Point(0,0))).move(180,500);
			(arc_sprite=creative.drawArc(60,0,40)).move(400,500);
			
			tree_sprite=creative.drawTree(600,120,90,40,4,60);
			
			(fish_sprite=creative.drawSimpleFish(100,50,5,30,4)).move(520,200);
			
			(arrow_sprite=creative.drawtArrow(50)).move(600,350);
			
			(flower_sprite=creative.drawSunFlower(20,10,0xffffff)).move(600,470);
			
			
		    slider=new Slider(this,30,50);
			slider.move(20,120);
			slider.addEventListener(Event.CHANGE,onChange);
			
			slider2=new Slider(this,5,10);
			slider2.move(180,120);
			slider2.addEventListener(Event.CHANGE,onChange2);
			
			slider3=new Slider(this,10,20);
			slider3.move(350,120);
			slider3.addEventListener(Event.CHANGE,onChange3);
			
			slider4=new Slider(this,3,32);
			slider4.move(20,270);
			slider4.addEventListener(Event.CHANGE,onChange4);
			
			slider5=new Slider(this,5,10);
			slider5.move(180,270);
			slider5.addEventListener(Event.CHANGE,onChange5);
			
			slider6=new Slider(this,2,20);
			slider6.move(350,270);
			slider6.addEventListener(Event.CHANGE,onChange6);
			
			slider7=new Slider(this,20,36);
			slider7.move(20,420);
			slider7.addEventListener(Event.CHANGE,onChange7);
			
			slider8=new Slider(this,50,60);
			slider8.move(180,420);
			slider8.addEventListener(Event.CHANGE,onChange8);
			
			slider9=new Slider(this,40,360);
			slider9.move(350,420);
			slider9.addEventListener(Event.CHANGE,onChange9);
			
			
			slider10=new Slider(this,1,6);
			slider10.move(20,560);
			slider10.addEventListener(Event.CHANGE,onChange10);
			
			slider11=new Slider(this,30,60);
			slider11.move(180,560);
			slider11.addEventListener(Event.CHANGE,onChange11);
			
			slider12=new Slider(this,40,360);
			slider12.move(350,560);
			slider12.addEventListener(Event.CHANGE,onChange12);
			
			slider13=new Slider(this,30,90);
			slider13.move(520,120);
			slider13.addEventListener(Event.CHANGE,onChange13);
			
			slider14=new Slider(this,100,150);
			slider14.move(520,270);
			slider14.addEventListener(Event.CHANGE,onChange14);
			
			slider15=new Slider(this,50,60);
			slider15.move(520,420);
			slider15.addEventListener(Event.CHANGE,onChange15);
			
			slider16=new Slider(this,20,30);
			slider16.move(520,560);
			slider16.addEventListener(Event.CHANGE,onChange16);
		}
		
		private function onChange(event:Event):void
		{
			creative.remove(Taiji_sprite);
			(Taiji_sprite=creative.drawTaiJi(slider.value)).move(80,50);
		}
		private function onChange2(event:Event):void
		{
			creative.remove(Star_sprite);
		    (Star_sprite=creative.drawStar(30,20,slider2.value)).move(250,50);		
		}
		
		private function onChange3(event:Event):void
		{
			creative.remove(Crear_sprite);
		    (Crear_sprite=creative.drawGearWheel(30,25,slider3.value)).move(400,50);		
		}
		private function onChange4(event:Event):void
		{
			 creative.remove(polygon_sprite);
			(polygon_sprite=creative.drawPolygon(30,slider4.value)).move(80,200);
		   	
		}
		
		private function onChange5(event:Event):void
		{
			
			 creative.remove(curve_sprite);
			(curve_sprite=creative.drawBeautifulCurve(70,int(slider5.value),10)).move(250,200);
		  		
		}
		private function onChange6(event:Event):void
		{
			 creative.remove(rose_sprite);
			(rose_sprite=creative.drawRose(50,int(slider6.value))).move(400,200);
		   
		}
		
		private function onChange7(event:Event):void
		{
			 creative.remove(circle_sprite);
			(circle_sprite=creative.drawCirque(40,int(slider7.value))).move(80,350);
		   
		}
		
		private function onChange8(event:Event):void
		{
			 creative.remove(diamond_sprite);
			(diamond_sprite=creative.drawDiamond(slider8.value)).move(250,350);
		   
		}
		
		private function onChange9(event:Event):void
		{
			 creative.remove(sector_sprite);
			(sector_sprite=creative.drawSector(60,0,int(slider9.value))).move(400,350);
		   
		}
		
		private function onChange10(event:Event):void
		{
			 creative.remove(helix_sprite);
			(helix_sprite=creative.drawHelixLine(2,int(slider10.value))).move(80,500);
		   
		}
		
		
		private function onChange11(event:Event):void
		{
			 creative.remove(sin_sprite);
			(sin_sprite=creative.drawSinLine(int(slider11.value),5,50,3,new Point(0,0))).move(180,500);
		   
		}
		
		private function onChange12(event:Event):void
		{
			 creative.remove(arc_sprite);
			(arc_sprite=creative.drawArc(60,0,int(slider12.value))).move(400,500);
		   
		}
		
		private function onChange13(event:Event):void
		{
			 creative.remove(tree_sprite);
			tree_sprite=creative.drawTree(600,120,90,40,4,int(slider13.value));
		   
		}
		
		private function onChange14(event:Event):void
		{
			 creative.remove(fish_sprite);
			(fish_sprite=creative.drawSimpleFish(int(slider14.value),50,5,30,4)).move(520,200);
		   
		}
		
		private function onChange15(event:Event):void
		{
			 creative.remove(arrow_sprite);
			(arrow_sprite=creative.drawtArrow(int(slider15.value))).move(600,350);
		   
		}
		
		private function onChange16(event:Event):void
		{
			 creative.remove(flower_sprite);
			(flower_sprite=creative.drawSunFlower(int(slider16.value),10,0xffffff)).move(600,470);
		   
		}
		
	}
	
}